//
//  RequestManager+Extand.m
//  魔兽大数据
//
//  Created by 王右 on 2017/11/14.
//  Copyright © 2017年 王右. All rights reserved.
//

#import "RequestManager+Extand.h"

@implementation RequestManager (Extand)
+ (BOOL)isNetWorkReachable{
    if ([UIDevice currentDevice].systemVersion.floatValue >= 9.0) {
        return [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus;
    }else{
        return YES;
    }
}

+ (void)startNetworkMonitoring{
    AFNetworkReachabilityManager *afNetworkReachabilityManager = [AFNetworkReachabilityManager sharedManager];
    [afNetworkReachabilityManager startMonitoring];
    [afNetworkReachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        
        switch (status) {
            case AFNetworkReachabilityStatusUnknown:{
                //                [self toastWithText:@"网络断开"];
                break;
            }
            case AFNetworkReachabilityStatusNotReachable:{
                //  [self toastWithText:@"无法检测到网络连接"];
                break;
            }
            case AFNetworkReachabilityStatusReachableViaWiFi:{
                //                [self toastWithText:@"网络切换至wifi环境"];
                break;
            }
                
            case AFNetworkReachabilityStatusReachableViaWWAN:{
                //                [self toastWithText:@"网络切换至流量环境"];
                break;
            }
        }
    }];
    
}


+ (void)stopNetworkMonitoring{
    AFNetworkReachabilityManager *afNetworkReachabilityManager = [AFNetworkReachabilityManager sharedManager];
    [afNetworkReachabilityManager stopMonitoring];
}


/* 当前在进行中的所有请求*/
+ (NSMutableArray *)arrayOfRequest{
    return nil;
}

/* 取消当前所有请求*/
+ (void)cancelAllRequest{
    
}
@end
